package com.core.user.pojo;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.core.role.RoleEnum;
import com.core.role.pojo.Role;
import com.core.user.SuperUserName;
import com.util.framework.BaseSearchCondition;

//wbq
public class User extends BaseSearchCondition{

	private Integer id;
	
	private String loginName;
	
	private	String password;
	
	private	String travelAgentId;
	
	private Integer	state;
	
	private String remark;
	
	private int addUserId;
	
	private Date addTime;
	
    private List<Role> roleList = new ArrayList<Role>();


    public User() {
    }

    public boolean isSuperAdmin() {
        return SuperUserName.ADMIN.equals(loginName);
    }

    public boolean isAdmin() {
        if (isSuperAdmin()) {
            return true;
        }

        for (Role role : roleList) {
            if (RoleEnum.isAdmin(role.getCode())) {
                return true;
            }
        }

        return false;
    }
	
	

	/**
	 * @return the loginName
	 */
	public String getLoginName() {
		return loginName;
	}

	/**
	 * @param loginName the loginName to set
	 */
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the roleList
	 */
	public List<Role> getRoleList() {
		return roleList;
	}

	/**
	 * @param roleList the roleList to set
	 */
	public void setRoleList(List<Role> roleList) {
		this.roleList = roleList;
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the state
	 */
	public Integer getState() {
		return state;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(Integer state) {
		this.state = state;
	}

	/**
	 * @return the travelAgentId
	 */
	public String getTravelAgentId() {
		return travelAgentId;
	}

	/**
	 * @param travelAgentId the travelAgentId to set
	 */
	public void setTravelAgentId(String travelAgentId) {
		this.travelAgentId = travelAgentId;
	}

	/**
	 * @return the remark
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * @param remark the remark to set
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * @return the addUserId
	 */
	public int getAddUserId() {
		return addUserId;
	}

	/**
	 * @param addUserId the addUserId to set
	 */
	public void setAddUserId(int addUserId) {
		this.addUserId = addUserId;
	}

	/**
	 * @return the addTime
	 */
	public Date getAddTime() {
		return addTime;
	}

	/**
	 * @param date the addTime to set
	 */
	public void setAddTime(java.util.Date date) {
		this.addTime = date;
	}

}
